package com.dhcc.utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class __Array {
	private static final Map<String, String> map;
	private static final Map<String, Operator<Object>> operators;
	static{
		map = UtilUtil.scan("com.dhcc.utils.array");
		operators = new ConcurrentHashMap<String, Operator<Object>>(map.size());
	}
	/**
	 * 执行字符串的操作
	 * @param operator
	 * @param arr
	 * @param args
	 * @return
	 */
	public static <T> T op(String operator, int[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, float[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, double[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, long[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, short[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, boolean[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, byte[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, char[] arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	public static <T> T op(String operator, Object arr, Object... args){
		return UtilUtil.<T, Object>op(map, operators, operator, arr, args);
	}
	
	public  static <T> void registry(String name, Class<? extends Operator<T>> clazz){
		UtilUtil.registry(name, clazz, map);
	}
}
